package cc.iotkit.data.model;

import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.listener.TenantListener;
import cc.iotkit.model.alert.AlertRecord;
import cn.hutool.core.date.DateTime;
import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.Filter;
import org.hibernate.annotations.FilterDef;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.ParamDef;

import javax.persistence.*;
import java.util.Date;

/**
 * @Title: cc.iotkit.data.model
 * @author: Sunne
 * @date: 2024-09-21 16:32
 * @Description: 代码备注说明
 */
@Data
@Entity
@ApiModel(value = "区域关系")
@Table(name = "area")
@AutoMapper(target = TbArea.class)
@FilterDef(name = "tenantFilter", parameters = {@ParamDef(name = "tenantId", type = "long")})
@Filter(name = "tenantFilter", condition = "tenant_id = :tenantId")
@EntityListeners(TenantListener.class)
public class TbArea extends BaseEntity implements TenantAware {
    @Id
    @GeneratedValue(generator = "SnowflakeIdGenerator")
    @GenericGenerator(name = "SnowflakeIdGenerator", strategy = "cc.iotkit.data.config.id.SnowflakeIdGenerator")
    @ApiModelProperty(value = "区域id")
    private long id;
    @ApiModelProperty(value = "设备组名称",required = true)
    private String name;

    /**
     * 所属用户
     */
    @ApiModelProperty(value = "所属用户")
    private String uid;

    /**
     * 分组说明
     */
    @ApiModelProperty(value = "区域说明",required  = true)
    private String remark;

    /**
     * 设备数量
     */
    @ApiModelProperty(value = "设备数量",required = true)

    private int deviceQty;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    private Date createAt = new DateTime();

    private Long tenantId;
}
